package com.mrzhou.auth.support;

public class IntegrationAuthenticationContext {

    private static ThreadLocal<IntegrationAuthenticationEntity> holder = new ThreadLocal<>();

    public static void set(IntegrationAuthenticationEntity authenticationEntity){
        holder.set(authenticationEntity);
    }

    public static IntegrationAuthenticationEntity get(){
        IntegrationAuthenticationEntity entity = holder.get();
        if(entity == null) {
            entity = new IntegrationAuthenticationEntity();
        }
        return entity;
    }

    public static void clear(){
        holder.remove();
    }

}
